package com.after.saas.oauth.factory;

import com.after.saas.oauth.domain.UserDTO;
import com.after.saas.oauth.service.UmsAdminService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;


/**
 * @Classname DictServiceHystrixFactory
 * @Description TODO
 * @auth after
 * @since 2021/7/20 21:12
 */

@Slf4j
@Component
public class AdminServiceHystrixFactory implements FallbackFactory<UmsAdminService> {


    @Override
    public UmsAdminService create(Throwable cause) {
        return new UmsAdminService() {
            @Override
            public UserDTO loadUserByUsername(String username) {
                log.error("username {} login error {}",username,cause.getMessage());
                return null;
            }
        };
    }
}
